﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcMusicStore.ViewModels;
using MvcMusicStore.Models;

namespace MvcMusicStore.Controllers
{
    public class StoreController : Controller
    {
        //
        // GET: /Store/

        public ActionResult Index()
        {
            var genreList = new List<string> { "Rock", "Jazz", "Country", "Pop", "Disco" };
            var viewModel = new StoreIndexViewModel { Genres = genreList, NumberOfGenres = genreList.Count };
            return View(viewModel);
        }

        public ActionResult Browse()
        {
            string genreName = Request.QueryString["genre"];
            var genre = new Genre { Name = genreName };

            var albums = new List<Album> {
                new Album { Genre = genre, Title = genre.Name + " album 1"},
                new Album { Genre = genre, Title = genre.Name + " album 2"}
            };
            return View(new StoreBrowseViewModel {
                Genre = genre,
                Albums = albums
            });
        }

        public ActionResult Details(int id)
        {
            return View(new Album { Title = "Sample Album" });
        }

    }
}
